/**
 * Function: 
 * 
 * File Created at 2011-3-12
 * $Id$
 * 
 * Copyright 2009 Alibaba.com Croporation Limited.
 * All rights reserved.
 */
package com.tidux.game.counttheboxes;


/**
 * TODO Comment of BoxesCombos
 * 
 * @author ren.tangr
 */
public class BoxesGroup {

    public static final int ONE_BOX = 1;

    public static final int EMPTY   = 0;
    
    /** boxes coordinates **/
    private int[][][]       coordinates;
    
    private String style;

    public BoxesGroup() {
        int rdm = (int) (Math.random()*BoxesCoordinates.getBoxesCoordinates().length);
        coordinates = BoxesCoordinates.getBoxesCoordinates()[rdm];
    }

    /** count the boxes **/
    public int countBoxes() {
        int sum = 0;
        
        if(coordinates==null)
            return sum;
        
        for (int i = 0; i < coordinates.length; i++) {
            for (int j = 0; j < coordinates[i].length; j++) {
                for (int k = 0; k < coordinates[i][j].length; k++) {
                    if (coordinates[i][j][k] == ONE_BOX) {
                        sum++;
                    }
                }
            }
        }
        return sum;
    }

    /**
     * @return the coordinates
     */
    public int[][][] getCoordinates() {
        return coordinates;
    }

    /**
     * @param coordinates the coordinates to set
     */
    public void setCoordinates(int[][][] coordinates) {
        this.coordinates = coordinates;
    }

    /**
     * @return the style
     */
    public String getStyle() {
        return style;
    }

    /**
     * @param style the style to set
     */
    public void setStyle(String style) {
        this.style = style;
    }
}
